/**
 * Created with Intellij IDEA.
 * Description;
 * User:TQ02
 * Data:2023-11-10
 * Time:13:37
 * Text：
 */
public class text2 {
    public static int notRun(int year){
        int count=0;
        int yearNum=year%10+year/10%10+year/10/10%10+year/10/10/10%10;
        for(int i=1;i<13;i++){
            if(i==1 || i==3 || i==5 || i==7 ||i==8 ||i==10 || i==12){
                for(int k=1;k<=31;k++){
                    if(yearNum==(i%10+i/10%10 + k%10+k/10%10)){
                        count++;
                    }
                }
            }else if(i==2){
                for(int k=1;k<=28;k++){
                    if(yearNum==(i%10+i/10%10 + k%10+k/10%10)){
                        count++;
                    }
                }
            }else{
                for(int k=1;k<=30;k++){
                    if(yearNum==(i%10+i/10%10 + k%10+k/10%10)){
                        count++;
                    }
                }
            }
        }
        return count;
    }
    public static int isRun(int year){
        int count=0;
        int yearNum=year%10+year/10%10+year/10/10%10+year/10/10/10%10;
        for(int i=1;i<13;i++){
            if(i==1 || i==3 || i==5 || i==7 ||i==8 ||i==10 || i==12){
                for(int k=1;k<=31;k++){
                    if(yearNum==(i%10+i/10%10 + k%10+k/10%10)){
                        count++;
                    }
                }
            }else if(i==2){
                for(int k=1;k<=29;k++){
                    if(yearNum==(i%10+i/10%10 + k%10+k/10%10)){
                        count++;
                    }
                }
            }else{
                for(int k=1;k<=30;k++){
                    if(yearNum==(i%10+i/10%10 + k%10+k/10%10)){
                        count++;
                    }
                }
            }
        }
        return count;
    }

    public static void main(String[] args) {
        int count=0;
        for(int year=1900;year<=9999;year++){
            if (year % 4 == 0 && year % 100 != 0)
            {
               count+=isRun(year);
            }
            else if (year % 400 == 0)
            {
              count+=isRun(year);
            }
            else
            {
                count+=notRun(year);
            }
        }
        System.out.println(count);
    }
}
